
//
//  DiscoverTableViewCellThird.m
//  XYFMApp
//
//  Created by 岁变 on 16/8/31.
//  Copyright © 2016年 岁变. All rights reserved.
//

#import "DiscoverTableViewCellThird.h"
#import "XYMacro.h"

@interface DiscoverTableViewCellThird ()

@property (nonatomic, strong) UIView *lineView;
@end

@implementation DiscoverTableViewCellThird

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _backImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"find_cat_header"]];
        [self.contentView addSubview:_backImageView];
        
        _typeLabel = [[UILabel alloc] init];
        _typeLabel.text = @"特别关注";
        _typeLabel.textColor = [UIColor redColor];
        _typeLabel.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:_typeLabel];
        
        _moreButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [_moreButton setTitle:@"更多" forState:UIControlStateNormal];
                
        [_moreButton setTitleColor:[UIColor colorWithRed:0.46 green:0.47 blue:0.50 alpha:1.00] forState:UIControlStateNormal];
        _moreButton.titleLabel.font = [UIFont systemFontOfSize:13];
        [self.contentView addSubview:_moreButton];
        
        _lineView = [[UIView alloc] initWithFrame:CGRectZero];
        _lineView.backgroundColor = [UIColor colorWithRed:1.00 green:0.27 blue:0.12 alpha:1.00];
        [self.contentView addSubview:_lineView];
        
        _picImageView = [[UIImageView alloc] init];
        _picImageView.layer.borderWidth = 1;
        _picImageView.layer.borderColor = [UIColor colorWithRed:0.39 green:0.39 blue:0.40 alpha:1.00].CGColor;
        [self.contentView addSubview:_picImageView];
        
    }
    return self;
}

- (void)setModel:(DiscoverModelFirstSpecial *)model {
    [_picImageView sd_setImageWithURL:[NSURL URLWithString:model.content_img] placeholderImage:PLACEHOLDERIMAGE];
}




- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    [_backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.mas_top).with.offset(5);
        make.left.equalTo(self.contentView.mas_left).with.offset(5);
        make.width.mas_offset(30);
        make.height.mas_offset(30);
    }];
    
    [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.mas_top).with.offset(34);
        make.left.equalTo(self.contentView.mas_left).with.offset(15);
        make.right.equalTo(self.contentView.mas_right).with.offset(-15);
        make.height.mas_offset(1);
    }];
    
    [_typeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.mas_top).with.offset(5);
        make.left.equalTo(_backImageView.mas_right).with.offset(5);
        make.width.mas_offset(200);
        make.height.mas_offset(28);
        
    }];
    
    [_moreButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.mas_top).with.offset(5);
        make.right.equalTo(self.contentView.mas_right).with.offset(-15);
        make.height.mas_offset(28);
        make.width.mas_offset(30);
    }];
    
    [_picImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.mas_top).with.offset(50);
        make.left.equalTo(self.contentView.mas_left).with.offset(15);
        make.right.equalTo(self.contentView.mas_right).with.offset(-15);
        make.bottom.equalTo(self.contentView.mas_bottom).with.offset(-5);
    }];
}






@end
